<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>libBigWig: io.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libBigWig
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">io.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;curl/curl.h&gt;</code><br />
</div>
<p><a href="io_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structURL__t.html">URL_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">This structure holds the file pointers and buffers needed for raw access to local and remote files.  <a href="structURL__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:a53551ff2ef7a2c1b938e94ef9592ab66"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a53551ff2ef7a2c1b938e94ef9592ab66">bigWigFile_type_enum</a> { <b>BWG_FILE</b> = 0, 
<b>BWG_HTTP</b> = 1, 
<b>BWG_HTTPS</b> = 2, 
<b>BWG_FTP</b> = 3
 }</td></tr>
<tr class="separator:a53551ff2ef7a2c1b938e94ef9592ab66"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a8f6a5aa097c9af9925171dd43d688f26"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a8f6a5aa097c9af9925171dd43d688f26">urlRead</a> (<a class="el" href="structURL__t.html">URL_t</a> *URL, void *buf, size_t bufSize)</td></tr>
<tr class="memdesc:a8f6a5aa097c9af9925171dd43d688f26"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads data into the given buffer.  <a href="#a8f6a5aa097c9af9925171dd43d688f26">More...</a><br /></td></tr>
<tr class="separator:a8f6a5aa097c9af9925171dd43d688f26"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a55a1fcb43f68a2b3c3a2b66a6459a0a8"><td class="memItemLeft" align="right" valign="top">CURLcode&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a55a1fcb43f68a2b3c3a2b66a6459a0a8">urlSeek</a> (<a class="el" href="structURL__t.html">URL_t</a> *URL, size_t pos)</td></tr>
<tr class="memdesc:a55a1fcb43f68a2b3c3a2b66a6459a0a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Seeks to a given position in a local or remote file.  <a href="#a55a1fcb43f68a2b3c3a2b66a6459a0a8">More...</a><br /></td></tr>
<tr class="separator:a55a1fcb43f68a2b3c3a2b66a6459a0a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8583139627ed0a732e6d9b4f80231c87"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a8583139627ed0a732e6d9b4f80231c87">urlOpen</a> (char *fname, CURLcode(*callBack)(CURL *), const char *mode)</td></tr>
<tr class="memdesc:a8583139627ed0a732e6d9b4f80231c87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a local or remote file.  <a href="#a8583139627ed0a732e6d9b4f80231c87">More...</a><br /></td></tr>
<tr class="separator:a8583139627ed0a732e6d9b4f80231c87"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add8705cdab8e6f2193a50bf095f08470"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#add8705cdab8e6f2193a50bf095f08470">urlClose</a> (<a class="el" href="structURL__t.html">URL_t</a> *URL)</td></tr>
<tr class="memdesc:add8705cdab8e6f2193a50bf095f08470"><td class="mdescLeft">&#160;</td><td class="mdescRight">Close a local/remote file.  <a href="#add8705cdab8e6f2193a50bf095f08470">More...</a><br /></td></tr>
<tr class="separator:add8705cdab8e6f2193a50bf095f08470"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a2f4038b5ef0a0e7dc45a20fc0bb83925"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a2f4038b5ef0a0e7dc45a20fc0bb83925">GLOBAL_DEFAULTBUFFERSIZE</a></td></tr>
<tr class="separator:a2f4038b5ef0a0e7dc45a20fc0bb83925"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>These are (typically internal) IO functions, so there's generally no need for you to directly use them! </p>
</div><h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="a53551ff2ef7a2c1b938e94ef9592ab66"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="io_8h.html#a53551ff2ef7a2c1b938e94ef9592ab66">bigWigFile_type_enum</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The enumerated values that indicate the connection type used to access a file. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="add8705cdab8e6f2193a50bf095f08470"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void urlClose </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Close a local/remote file. </p>
<p>This will perform the cleanup required on a URL_t*, releasing memory as needed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">URL</td><td>A <a class="el" href="structURL__t.html" title="This structure holds the file pointers and buffers needed for raw access to local and remote files...">URL_t</a> * pointing to a valid opened file or remote URL.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd>URL will no longer point to a valid location in memory! </dd></dl>

</div>
</div>
<a class="anchor" id="a8583139627ed0a732e6d9b4f80231c87"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structURL__t.html">URL_t</a>* urlOpen </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>fname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">CURLcode(*)(CURL *)&#160;</td>
          <td class="paramname"><em>callBack</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Open a local or remote file. </p>
<p>Opens a local or remote file. Currently, http, https, and ftp are the only supported protocols and the URL must then begin with "http://", "https://", or "ftp://" as appropriate.</p>
<p>For remote files, an internal buffer is used to hold file contents, to avoid downloading entire files before starting. The size of this buffer and various variable related to connection timeout are set with <a class="el" href="bigWig_8h.html#a4aa7fa5e6146a2719feb8815c9bccd62" title="Initializes curl and global variables. This MUST be called before other functions (at least if you wa...">bwInit()</a>.</p>
<p>Note that you <b>must</b> run <a class="el" href="io_8h.html#add8705cdab8e6f2193a50bf095f08470" title="Close a local/remote file. ">urlClose()</a> on this when finished. However, you would typically just use <a class="el" href="bigWig_8h.html#a55e46bf04f13da31a3971044b85c9243" title="Opens a local or remote bigWig file. This will open a local or remote bigWig file. Writing of local bigWig files is also supported. ">bwOpen()</a> rather than directly calling this function.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fname</td><td>The file name or URL to open. </td></tr>
    <tr><td class="paramname">callBack</td><td>An optional user-supplied function. This is applied to remote connections so users can specify things like proxy and password information. </td></tr>
    <tr><td class="paramname">mode</td><td>"r", "w" or NULL. If and only if the mode contains the character "w" will the file be opened for writing.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structURL__t.html" title="This structure holds the file pointers and buffers needed for raw access to local and remote files...">URL_t</a> * or NULL on error. </dd></dl>

</div>
</div>
<a class="anchor" id="a8f6a5aa097c9af9925171dd43d688f26"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t urlRead </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>bufSize</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads data into the given buffer. </p>
<p>This function will store bufSize data into buf for both local and remote files. For remote files an internal buffer is used to store a (typically larger) segment of the remote file.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">URL</td><td>A <a class="el" href="structURL__t.html" title="This structure holds the file pointers and buffers needed for raw access to local and remote files...">URL_t</a> * pointing to a valid opened file or remote URL. </td></tr>
    <tr><td class="paramname">buf</td><td>The buffer in memory that you would like filled. It must be able to hold bufSize bytes! </td></tr>
    <tr><td class="paramname">bufSize</td><td>The number of bytes to transfer to buf.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of bytes stored in buf, which should be bufSize on success and something else on error.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>Note that on error, URL for remote files is left in an unusable state. You can get around this by running <a class="el" href="io_8h.html#a55a1fcb43f68a2b3c3a2b66a6459a0a8" title="Seeks to a given position in a local or remote file. ">urlSeek()</a> to a position outside of the range held by the internal buffer. </dd></dl>

</div>
</div>
<a class="anchor" id="a55a1fcb43f68a2b3c3a2b66a6459a0a8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CURLcode urlSeek </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>pos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Seeks to a given position in a local or remote file. </p>
<p>For local files, this will set the file position indicator for the file pointer to the desired position. For remote files, it sets the position to start downloading data for the next <a class="el" href="io_8h.html#a8f6a5aa097c9af9925171dd43d688f26" title="Reads data into the given buffer. ">urlRead()</a>. Note that for remote files that running <a class="el" href="io_8h.html#a55a1fcb43f68a2b3c3a2b66a6459a0a8" title="Seeks to a given position in a local or remote file. ">urlSeek()</a> with a pos within the current buffer will simply modify the internal offset.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">URL</td><td>A <a class="el" href="structURL__t.html" title="This structure holds the file pointers and buffers needed for raw access to local and remote files...">URL_t</a> * pointing to a valid opened file or remote URL. </td></tr>
    <tr><td class="paramname">pos</td><td>The position to seek to.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CURLE_OK on success and a different CURLE_XXX on error. For local files, the error return value is always CURLE_FAILED_INIT </dd></dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a2f4038b5ef0a0e7dc45a20fc0bb83925"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t GLOBAL_DEFAULTBUFFERSIZE</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The size of the buffer used for remote files. </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Nov 18 2016 22:54:37 for libBigWig by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
